import  http from '@/utils/http';
import { async } from 'q';

// 获取多轮列表
export async function getDialogs(body) {
  return http.post('/cloud/dialog/getDialogs',body)
}

// 设置多轮会话状态
export async function setDialogStatus(body) {
  return http.post('/cloud/dialog/setDialogStatus',body)
}

// 删除多轮会话
export async function deleteDialog(body) {
  return http.post('/cloud/dialog/deleteDialog',body)
}

// 添加多轮对话
export async function addDialog(body) {
  return http.post('/cloud/dialog/addDialog',body)
}

// 获取全局设置
export async function getSetting(body) {
  return http.get('/cloud/dialog/setting',body)
}

// 保存全局设置
export async function doSetting(body) {
  console.log("body :" + JSON.stringify(body));
  return http.post('/cloud/dialog/setting',body)
}

// 根据多轮id获取对应的词槽
export async function getDialogSlots(body) {
  return http.post('/cloud/dialog/getDialogSlots',body)
}

// 根据多轮id获取对应的图数据
export async function getDialogTemplate(body) {
  return http.post('/cloud/dialog/getDialogTemplate',body)
}

// 根据多轮id，节点id，get stage

export async function getStageBydialogIdAndNodeId(body) {
  return http.get('/cloud/dialog/stage',body)
}

// 添加或编辑全局设置-特殊情况处理
export async function specialQaDoAdd(body) {
  return http.post('/cloud/dialog/saveGlobalQa',body)
}

// 删除全局设置-特殊情况处理
export async function doSaveQaList(body) {
  return http.post('/cloud/dialog/setting',body)
}

// 根据多轮id，节点id，save stage

export async function saveStageBydialogIdAndNodeId(body) {
  return http.post('/cloud/dialog/stage',body)
}


// 根据多轮id add slot

export async function updateSlotByAddSlot(body) {
  return http.post('/cloud/dialog/updateSlot',body)
}

// 根据多轮id slotID查询slot是否被使用

export async function querySlotIsUsedByDialog(body) {
  return http.post('/cloud/dialog/slotIsUsedByDialog',body)
}

// 根据多轮id save dialog

export async function saveDialogTemplate(body) {
  return http.post('/cloud/dialog/template',body)
}

// 保存多轮会话数据
export async function saveStage(body) {
  return http.post('/cloud/dialog/stage',body)
}
// 分词接口
export async function splitWord(body) {
  return http.post('/cloud/common/splitWord',body)
}

// 获取多轮词槽列表
export async function getCommonDialogSlots(body) {
  return http.post('/cloud/dialog/stage/slot/getDialogSlots',body)
}


// 获取多轮inquire
export async function getDialogInquire(body){
  return http.post('/cloud/dialog/stage/slot/inquire',body)
}

// 获取多轮用户所有词典
export async function getUserAllDict(body){
  return http.post('/cloud/dialog/getAllDict',body)
}

// 获取多轮配置的API
export async function getAllApi(body){
  return http.post('/cloud/dialog/getApiInfoFromSetting',body)
}

// 获取API列表
export async function loadActionApis(body) {
  return http.postFormUrlEncoded('/cloud/api/actionApi/loadActionApis',body)
}

// 获取API列表
export async function loadActionApi(body) {
  return http.post('/cloud/api/actionApi/loadActionApi',body)
}

// 训练多轮对话
export  async function  startTraining(body) {
  return http.post('/cloud/dialog/startTraining',body)
}

// 发布多轮
export  async function publish (body) {
  return  http.post('/cloud/dialog/publish',body)
}

// 根据词擦id查询核心词
export  async function getCoreWordById(body) {
  return http.post('/cloud/slotqa/getDictItemFromSlotId',body)
}


// 根据多轮id查询训练结果
export  async function getTrainResult(body) {
  return http.get('/cloud/dialog/getTrainResult',body)
}

// 根据多轮id查询当前状态
export  async function getStatusById(body) {
  return http.get('/cloud/dialog/getStatusById',body)
}

// 根据多轮ID查询训练进度
export  async function getProgress(body) {
  return http.get('/cloud/dialog/getProgress',body)
}


// 根据多轮id修改多轮name
export  async function updateDialogName(body) {
  return http.post('/cloud/dialog/updateDialogName',body)
}
